const SYMBOL_POINT = {
  type: "simple-marker",
  style: "circle",
  size: 10,
  color: [255, 128, 0, 0.8],
  outline: {
    color: [255, 128, 0, 1],
    size: 10
  }
}
const SYMBOL_POLYLINE = {
  type: "simple-line",
  color: [255, 128, 0, 1],
  width: 2
}
const SYMBOL_POLYGON = {
  type: "simple-fill",
  color: [255, 128, 0, 0.3],
  outline: {
    color: [255, 128, 0, 1],
    width: 2
  }
}
const SYMBOL_BUFFER = {
  type: "simple-fill",
  color: [255, 180, 0, 0.1],
  outline: {
    color: [255, 180, 0, 1],
    width: 2
  }
}

/**
 * 绘制点符号样式
 * style: circle 圆形、cross十字形、diamond菱形、square方形、x X形
 */
const QUERY_SYMBOL_POINT = {
  type: "simple-marker",
  style: "circle",
  size: 10,
  color: [18, 252, 252, 0.4],
  outline: {
    color: [18, 252, 252, 1],
    size: 10
  }
}
const QUERY_SYMBOL_POLYLINE = {
  type: "simple-line",
  color: [18, 252, 252, 1],
  width: 2
}
const QUERY_SYMBOL_POLYGON = {
  type: "simple-fill",
  color: [18, 252, 252, 0.1],
  outline: {
    color: [18, 252, 252, 1],
    width: 2
  }
}

const TXT_SYMBOL = {
  type: 'text',  // autocasts as new TextSymbol()
  color:'#000',
  haloColor:'white',//给字体加框
  haloSize: '1px',
  text:'',
  xoffset:0,
  yoffset:0,
  font: {
    size: 12,
    family: 'microsoft-yahei',
    weight: 'bold'
  }
}

const GET_LOCATE_SYMBOL = function (type) {
  let symbol = null;
  switch (type) {
    case "polygon": {
      symbol = QUERY_SYMBOL_POLYGON
      break;
    }
    case "polyline": {
      symbol = QUERY_SYMBOL_POLYLINE
      break;
    }
    case "point": {
      symbol = QUERY_SYMBOL_POINT
      break;
    }
    default :
      break;
  }
  return JSON.parse(JSON.stringify(symbol));
}
const SMS_DRAW = {
  type: "simple-marker",
  style: "circle",
  color: [255, 0, 0],
  size: "10px",  // pixels
  outline: {
    color: [255, 255, 255],
    width: 1  // points
  }
}


/**
 * 绘制折线符号样式
 * style : dash、dash-dot、dot、long-dash、long-dash-dot、long-dash-dot-dot、none、short-dash、
 * short-dash-dot、short-dash-dot-dot、short-dot、solid
 */
const SLS_DRAW = {
  type: "simple-line",
  color: [255, 0, 0],
  style: "solid",
  width: 2,
  cap: "round",
  join: "round"
}


/**
 * 绘制面符号样式
 * style: backward_diagonal、cross、diagonal_cross、forward_diagonal、horizontal、null、solid、vertical
 */
const SFS_DRAW = {
  type: "simple-fill",
  color: [0, 0, 0, 0.1],
  style: "solid",
  outline: {
    color: [255, 0, 0],
    width: 2
  }
}

/**
 * 定位图片点符号
 */
const LOCATION_SYMBOL = {
  type: "picture-marker",
  url: "/static/images/components/map-controls/location.png",
  width: 23,
  height: 23,
  xoffset: 0,
  yoffset: 0,
  angle: 0
}

/*********************************************************************************
 /////////////////////////////////////////////////////////////////////////////////////
 *  渲染点符号样式
 * style: circle 圆形、cross十字形、diamond菱形、square方形、x X形
 */
const SMS_RENDER = {
  type: "simple-marker",
  style: "circle",
  color: [0, 255, 255],
  size: "10px",  // pixels
  outline: {
    color: [255, 255, 255],
    width: 1  // points
  }
}

/**
 * 渲染折线符号样式
 * style : dash、dash-dot、dot、long-dash、long-dash-dot、long-dash-dot-dot、none、short-dash、
 * short-dash-dot、short-dash-dot-dot、short-dot、solid
 */
const SLS_RENDER = {
  type: "simple-line",
  color: [0, 255, 255],
  style: "solid",
  width: 2
}
/**
 * 渲染面符号样式
 * style: backward_diagonal、cross、diagonal_cross、forward_diagonal、horizontal、null、solid、vertical
 */
const SFS_RENDER = {
  type: "simple-fill",
  color: [0, 0, 0, 0.1],
  style: "solid",
  outline: {
    color: [0, 255, 255],
    width: 2
  }
}
export {
  GET_LOCATE_SYMBOL,
  SYMBOL_POINT,
  SYMBOL_POLYLINE,
  SYMBOL_POLYGON,
  SYMBOL_BUFFER,
  SMS_DRAW,
  SLS_DRAW,
  SFS_DRAW,
  LOCATION_SYMBOL,
  SMS_RENDER,
  SLS_RENDER,
  SFS_RENDER,
  TXT_SYMBOL
}
